package sdfi.lee.Entity.base;

import java.io.Serializable;


/**
 * This is an object that contains data related to the lab table.
 * Do not modify this class because it will be overwritten if the configuration file
 * related to this class is modified.
 *
 * @hibernate.class
 *  table="lab"
 */

public abstract class BaseLab  implements Serializable {

	public static String REF = "Lab";
	public static String PROP_LABDESCRIBE = "Labdescribe";
	public static String PROP_LABNAME = "Labname";
	public static String PROP_ID = "Id";


	// constructors
	public BaseLab () {
		initialize();
	}

	/**
	 * Constructor for primary key
	 */
	public BaseLab (java.lang.Integer id) {
		this.setId(id);
		initialize();
	}

	protected void initialize () {}



	private int hashCode = Integer.MIN_VALUE;

	// primary key
	private java.lang.Integer id;

	// fields
	private java.lang.String labname;
	private java.lang.String labdescribe;

	// collections
	private java.util.Set<sdfi.lee.Entity.Task> tasks;
	private java.util.Set<sdfi.lee.Entity.Yiqi> yiqis;



	/**
	 * Return the unique identifier of this class
     * @hibernate.id
     *  generator-class="sequence"
     *  column="Id"
     */
	public java.lang.Integer getId () {
		return id;
	}

	/**
	 * Set the unique identifier of this class
	 * @param id the new ID
	 */
	public void setId (java.lang.Integer id) {
		this.id = id;
		this.hashCode = Integer.MIN_VALUE;
	}




	/**
	 * Return the value associated with the column: labname
	 */
	public java.lang.String getLabname () {
		return labname;
	}

	/**
	 * Set the value related to the column: labname
	 * @param labname the labname value
	 */
	public void setLabname (java.lang.String labname) {
		this.labname = labname;
	}



	/**
	 * Return the value associated with the column: labdescribe
	 */
	public java.lang.String getLabdescribe () {
		return labdescribe.replace("/project", "");
	}

	/**
	 * Set the value related to the column: labdescribe
	 * @param labdescribe the labdescribe value
	 */
	public void setLabdescribe (java.lang.String labdescribe) {
		this.labdescribe = labdescribe;
	}



	/**
	 * Return the value associated with the column: Tasks
	 */
	public java.util.Set<sdfi.lee.Entity.Task> getTasks () {
		return tasks;
	}

	/**
	 * Set the value related to the column: Tasks
	 * @param tasks the Tasks value
	 */
	public void setTasks (java.util.Set<sdfi.lee.Entity.Task> tasks) {
		this.tasks = tasks;
	}

	public void addToTasks (sdfi.lee.Entity.Task task) {
		if (null == getTasks()) setTasks(new java.util.TreeSet<sdfi.lee.Entity.Task>());
		getTasks().add(task);
	}



	/**
	 * Return the value associated with the column: Yiqis
	 */
	public java.util.Set<sdfi.lee.Entity.Yiqi> getYiqis () {
		return yiqis;
	}

	/**
	 * Set the value related to the column: Yiqis
	 * @param yiqis the Yiqis value
	 */
	public void setYiqis (java.util.Set<sdfi.lee.Entity.Yiqi> yiqis) {
		this.yiqis = yiqis;
	}

	public void addToYiqis (sdfi.lee.Entity.Yiqi yiqi) {
		if (null == getYiqis()) setYiqis(new java.util.TreeSet<sdfi.lee.Entity.Yiqi>());
		getYiqis().add(yiqi);
	}




	public boolean equals (Object obj) {
		if (null == obj) return false;
		if (!(obj instanceof sdfi.lee.Entity.Lab)) return false;
		else {
			sdfi.lee.Entity.Lab lab = (sdfi.lee.Entity.Lab) obj;
			if (null == this.getId() || null == lab.getId()) return false;
			else return (this.getId().equals(lab.getId()));
		}
	}

	public int hashCode () {
		if (Integer.MIN_VALUE == this.hashCode) {
			if (null == this.getId()) return super.hashCode();
			else {
				String hashStr = this.getClass().getName() + ":" + this.getId().hashCode();
				this.hashCode = hashStr.hashCode();
			}
		}
		return this.hashCode;
	}


	public String toString () {
		return super.toString();
	}


}